//
//  MyProfitStore.m
//  NewPro
//
//  Created by 何荧红 on 2019/4/28.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "MyProfitStore.h"

@implementation MyProfitStore

#pragma mark 我的收益
- (void)GetMyProfitWithID:(NSString *)customId Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/myEarnings/earnings",IP];
    NSDictionary *prams = @{
                            @"customId":customId
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 历史收益
- (void)GetMyHistoryProfitWithID:(NSString *)customId Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/myEarnings/history",IP];
    NSDictionary *prams = @{
                            @"customId":customId
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

#pragma mark 推广分润
- (void)GetMyPromoteWithID:(NSString *)customId Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/tradeDetail/dividedDetailList",IP];
    NSDictionary *prams = @{
                            @"customId":customId
                            };
    [HttpTool postUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}




@end
